package fsm

import "fmt"

type (
	Error interface {
		error
		IllegalEvent() string
		CurrentState() string
	}

	StateMachineError struct {
		event string
		state string
	}
)

func (e StateMachineError) Error() string {
	return fmt.Sprintf("[StateMachine]: No transition found for event [%s] in [%s] state\n", e.IllegalEvent(), e.CurrentState())
}

func (e StateMachineError) IllegalEvent() string {
	return e.event
}

func (e StateMachineError) CurrentState() string {
	return e.state
}
